﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Reports.Rest
{
    public partial class InputParamForm : Form,IntegrationInterface.IDIProjectForm
    {
        public InputParamForm()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        #region IDIProjectForm Members
        private string _connectionString = string.Empty;
        public string ConnectionString
        {
            get
            {
                return _connectionString;
            }
            set
            {
                _connectionString = value;
            }
        }
        private string _login = string.Empty;
        public string Login
        {
            get
            {
                return _login;
            }
            set
            {
                _login = value;
            }
        }

        public Form MailForm
        {
            get
            {
                return this;
            }
        }
        private object _obj;
        public object CommonProperty
        {
            get
            {
                return _obj;
            }
            set
            {
                _obj = value;
            }
        }

        #endregion

        private void button1_Click(object sender, EventArgs e)
        {
            Reports.Rest.DataSet data = new Reports.Rest.DataSet();
            string NameAptek = System.Configuration.ConfigurationSettings.AppSettings["NameAptek"];
            //string DeptName = NameAptek;
            DateTime tmp = Reports.Util.DTConvert.RoundDate(dptDateF.Value);
            Reports.Rest.DataLoader.GetData(data.Data, this.ConnectionString, NameAptek, tmp);
            Reports.Rest.PrintForm pf = new PrintForm(data);
            pf.DateF = dptDateF.Value;
            string repPath = (string)this.CommonProperty;
            pf.InitReport(repPath);
            pf.MdiParent = this.MdiParent;
            pf.Show();
        }
    }
}